package main

import (
	"fmt"
	"strconv"
)

func main() {
	//作业:
	//1.字符串反转,从键盘接收一个字符串，对它进行反转
	//2.字符串压缩==》"aaabbaacc"==>"a3b2a2c2"
	//1.
	var str1 string
	var str2 string
	fmt.Scan(&str1)
	for _, i := range str1 {
		str2 = string(i) + str2
	}
	fmt.Println(str2)

	//2
	var str3 string
	var result string
	var count int
	fmt.Scan(&str3)
	str4 := str3 + " "
	for i := 0; i < len(str4)-1; i++ {
		if string(str4[i]) != string(str4[i+1]) {
			count += 1
			result += string(str4[i])
			result += strconv.Itoa(count)
			count = 0
		} else {
			count += 1
		}
	}

	fmt.Println(result)
}
